<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="js/echarts.js"></script>
    <script src="jq/jquery.js"></script>
    <style>
        .box {
            width: 600px;
            height: 400px;
            border: 1px solid #999;
            display: block;
        }
    </style>
</head>

<body>
    <div id="chartA" class="box"></div>
    <input type="button" value="重新载入新数据" onclick="loadData()">
    <script>
        let chartA = echarts.init(document.querySelector("#chartA"));
        function initEcharts(data) {
            chartA.setOption({
                legend: {},
                tooltip: {},
                dataset: {
                    source:data.list
                },
                xAxis: { type: 'category' },
                yAxis: {},
                series: [{ type: 'bar' }]
            });
            chartA.hideLoading();
        }
        async function loadData(){
            chartA.showLoading();
            let res=await $.get("./data/data.json").promise();
            setTimeout(function(){
                initEcharts(res);
            },4000);
        }
    </script>
</body>

</html>